<%@ page import="javax.servlet.annotation.WebServlet" %>
<%@ page import="pojo.Business" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: claw
  Date: 2021/10/25
  Time: 17:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

</head>
<body>

<nav class="navbar navbar-light bg-light">
    <div class="container-fluid">
        <a class="btn btn-secondary" href="canteenChoose.jsp" role="button">返回</a>
    </div>

</nav>

<div class="container">
    <div class="row">

        <div class="container">
            <div class="row">
                <%  int i=1;
                    List<Business> businessList=(List<Business>)application.getAttribute("businessList");
                    if (businessList==null){
                        businessList=(List<Business>)request.getAttribute("businessList");
                        application.setAttribute("businessList",businessList);
                    }
                    for (Business bus:businessList) {

                %>
                <div class="col">
                    <div class="card" style="width: 18rem;">
                        <%System.out.println(bus.getBus_no());%>
                        <img src="${pageContext.request.contextPath}/img/bus<%=bus.getBus_no()%>.jpg" class="card-img-top" width="200" height="200">
                        <div class="card-body">
                            <h5 class="card-title"><%=bus.getBus_name()%></h5>
                            <p class="card-text">食品卫生等级<%=bus.getBus_grade()%></p>
                            <a href="dishesServlet.do?bus_no=<%=i%>" class="btn btn-primary">点餐</a>
                        </div>
                    </div>
                </div>
                <%
                    i++;
                    }
                %>
            </div>
        </div>
    </div>
</div>
</body>
</html>
